﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.LookAndFeel;
using ChartPerfMon;
using View.Statistics;
using DevExpress.XtraSplashScreen;
using TestMySqlConnetPoll;
using View.Chart.DC;
using View.Chart.WDW;
using View.Chart.ZNGD;
using View.Table;
using NewStation;
using View.History;
using View.Journal;
using View.Journal.UserView;
using View.Setting;
using View.Setting.TCRepair;
using View.Replay;

namespace View
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application    .
        /// </summary>
        [STAThread]
        static void Main()
        {
            //SplashScreenManager.ShowForm(typeof(SplashScreen1));            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //DevExpress.Skins.SkinManager.EnableFormSkins();            
            //DevExpress.UserSkins.BonusSkins.Register();
            //UserLookAndFeel.Default.SetSkinStyle("DevExpress Style"); //DevExpress Dark Style
            MySql.InitMySql("csm2014", "192.168.10.222");
            INIFile INIF = new INIFile();
            string s = INIF.GetINI_FilePath();
            INIF.Read_DC_INI(s + "\\dc.ini");
            INIF.Read_GD_INI(s + "\\gd.ini");
            INIF.Read_JC_INI(s + "\\jc.ini");
            INIF.Read_ZH_INI(s + "\\zh.ini");
            INIF.Read_XHJ_INI(s + "\\xhj.ini");
            INIF.Read_YP_INI(s + "\\yp.ini");
            INIF.Read_LK1_INI(s + "\\lk1.ini");
            INIF.Read_Digit_INI(s + "\\digit.ini");
            INIF.Read_MsgGather_INI(s + "\\msggather.ini");
            INIF.Read_FLBL_INI(s + "\\flbl.ini");
            INIF.ReadOther_INI(s + "\\other.ini");

            //c_RealTimeValue.InitJyError += new EventHandler<MessageInfoEventArgs>(c_RealTimeValue_InitJyError);
            //c_RealTimeValue.InitLlError += new EventHandler<MessageInfoEventArgs>(c_RealTimeValue_InitLlError);
            c_RealTimeValue.MessageInfo += new EventHandler<MessageInfoEventArgs>(c_RealTimeValue_MessageInfo);
            c_RealTimeValue.InitRealTimeData();
            //c_RealTimeValue.RefreshRealTimeValue();

            c_Device.InitDcdlqxDevList();
            c_Device.InitWdwErrorQX_DevList();
            c_Device.InitGybdcDYbx_DevList();
            c_Device.InitUserScanAnnalConfig();
            c_Device.InitTongJiConfig();
            c_Device.InitButtenUseConfig();
            c_ReceiveData.StartRevPipeData();
            //c_NetCom.InitNetCom();
            float k = 0;
            int kk = 12345;

            k = (float)kk / 1000;
            int m = (int)k;
            Console.WriteLine(k.ToString());
            Console.WriteLine(m.ToString());
            C_MyPipe.StartPipeClient();
            objFLBL_Struct objFlbl = new objFLBL_Struct();
            objFlbl.SectionName = "2-45G";
            objFlbl.SectionType = 3;
            objFlbl.FlblType = 1;
            objFlbl.FlblReason = "轨面生锈";
            objFlbl.PersonID = 1369;
            INIF.Modify_FlblSetValue(objFlbl);

            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-CN");//MainForm DemoChartForm FormStatistics
            DevExpress.Utils.AppearanceObject.DefaultFont = new System.Drawing.Font("宋体", 9); //解决输出PDF乱码
            //Application.Run(new DemoChartForm("电源屏", View.Chart.ChartType_Data.DAY));
            DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true;
            Application.Run(new MainForm());

            //Application.Run(new FrmDailyTable("电源屏"));
            //Application.Run(new HistorySwitch());

            //MainForm
            //DCDZCurve FrmDailyTest
            //ExternalNetworkFaultCurve
            //new DemoChartForm("电源屏", Chart.ChartType_Data.DAY)
            //System.Threading.Thread.Sleep(800);
            //SplashScreenManager.CloseForm();

        }

        static void c_RealTimeValue_MessageInfo(object sender, MessageInfoEventArgs e)
        {
            //throw new NotImplementedException();
        }

        static void c_RealTimeValue_InitLlError(object sender, MessageInfoEventArgs e)
        {
            //throw new NotImplementedException();
        }

        static void c_RealTimeValue_InitJyError(object sender, MessageInfoEventArgs e)
        {
            //throw new NotImplementedException();
        }
    }
}